<template>
    <div class>
      <el-card class="ep-card ep-search">
          <el-form :model="searchForm" label-width="80px">
              <el-row :gutter="20">
                  <el-col :span="9">
                      <el-form-item label="项目名称" size="small"> 
                          <el-input v-model="searchForm.projName"  placeholder="请输入项目名称"></el-input>
                      </el-form-item>
                  </el-col>
                <el-col :span="9">
                  <el-button type="primary" size="small" icon="el-icon-search" @click="init">查询</el-button>
                </el-col>
              </el-row>
          </el-form>
      </el-card>
      <el-table :data="tableData" border style="width: 100%" size="mini">
        <el-table-column type="index" label="序号" align="center" width="50">
        </el-table-column>
        <el-table-column prop="projCode" label="项目编号" align="center" width="260">
        </el-table-column>
        <el-table-column prop="projName" label="项目名称" align="center" width="120">
        </el-table-column>
        <el-table-column prop="handleTime" label="受理日期" align="center" width="120">
        </el-table-column>
        <el-table-column prop="serviceType"  align="center" label="业务品种">
        </el-table-column>
        <el-table-column prop="curreny"  align="center" label="授信金额">
        </el-table-column>
        <el-table-column prop="guaterm"  align="center" label="授信期限">
        </el-table-column>
        <el-table-column prop="createUserName" align="center" label="创建人">
        </el-table-column>
        <el-table-column prop="organName" align="center" label="机构名称">
        </el-table-column> 
        <el-table-column prop="status" align="center" label=" 项目状态">
        </el-table-column>
        <el-table-column label="操作" align="center" width="100">
          <template slot-scope="scope" >
            <el-button @click="handleClick(scope.row)" :disabled="scope.row.status=='未提交'" type="text" size="small">查看进度</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-card style="text-align:right;">
        <el-pagination @size-change="sizeChange" @current-change="currentChange" :current-page="currentPage" :page-sizes="[ 10, 20,30, 40]" :page-size="pageSize" background layout="total, sizes, prev, pager, next" :total="total"></el-pagination>
      </el-card>
      <el-dialog title="项目进展" :visible.sync="dialogVisible" :close-on-click-modal="false">
          <projMarch ref="projMarch"></projMarch>
      </el-dialog>
    </div>
  </template>
  
  <script>
     import projMarch from "@/pages/biz/proj/projMarch"
  export default {
    components: {projMarch},
    data() {
      return {
        dialogVisible:false,
        total: 0,
        pageSize: 10,
        currentPage: 1,
        tableData: [],
        searchForm: {
                  projName: '',
        },
      };
    },
    computed: {},
    mounted() {
      this.init();
    },
    methods: {
      handleClick(row) {
        let path='/proj/projMarch'
        this.$router.push({
                  path: path,
                  query: {
                    projId:row.id,
                    projCode:row.projCode
                  }
              });
  
      },
      sizeChange(n) {
        this.pageSize = n;
        this.init();
      },
      currentChange(n) {
        this.currentPage = n;
        this.init();
      },
      init() {
        let user=JSON.parse(sessionStorage.getItem("user"));
        let dataSql="";
        if(user.grantOrganIds){
          dataSql=user.grantOrganIds;
        }
        let params = {
          pageNum: this.currentPage,
          pageSize: this.pageSize,
          projName: this.searchForm.projName,
          createUserId:user.id,
          createUserName:user.realName,
          dataSql:dataSql,
        };
        this.$api.formPost(  "/api/biz/project/doGetList", params)
          .then(res => {
            if (res.retHead.code === "0000000") {
              this.tableData = res.retBody.list;
              this.total = res.retBody.total;
            }
          });
      }
    },
    created() {}
  };
  </script>
  <style lang='scss' scoped>
  </style>